<extend name="Layout:layout_content" />
<block name="head_after">
    <style type="text/css">
        .xsui-tabs li { display:inline-block; padding:.3em 3em; border:solid 1px #ddd; margin-left:-10px;}
        .xsui-tabs .xsui-icon-only { padding:.3em 1em;}
        .xsui-tabs .fa { margin-right:3px;}
    </style>
</block>
<block name="body_main">
    <div class="grid-parent xsui-page-header">
        <div class="grid-60 mobile-grid-100 grid-parent">
            <a href="{:U('user_edit')}" class="xsui-btn ui-state-default xsui-lnk-add"><i class="fa fa-plus"></i>新增</a>
            <a href="{:U('user_export')}" class="xsui-btn ui-state-default"><i class="fa fa-save"></i>导出</a>
            <a href="{:U('user_export','id=varkey')}" class="xsui-btn ui-state-default xsui-lnk-remove"><i class="fa fa-remove"></i>批量删除</a>
        </div>
        <div class="grid-40 mobile-grid-100 grid-parent xsui-text-right">
            <a href="#" class="xsui-btn ui-state-default xsui-lnk-refresh"><i class="fa fa-refresh"></i>刷新</a>
            <span class="xsui-input-group"><form method="get"><input type="text" name="search_key" value="{$search.search_key}" placeholder="用户名/姓名/手机号码" /><button type="submit" class="ui-state-default"><i class="fa fa-search"></i>搜索</button><button id="btn-search-dialog" class="ui-state-default xsui-icon-only" title="高级搜索"><i class="fa fa-gear"></i></button></form></span>
        </div>
        <div id="search-dialog" class="xsui-hidden">
            <form method="get" class="xsui-form">
                <div class="xsui-form-field">
                    <label>用户名：</label><input type="text" name="user_name" value="{$search.user_name}" />
                </div>
                <button type="submit">保存</button>
            </form>
        </div>
    </div>
    <div class="xsui-page-header">
        <ul class="xsui-tabs">
            <!--
            <li class="ui-state-default xsui-icon-only"><a href="{:U('UserType/type_list')}"><i class="fa fa-list-alt"></i>类型管理</a></li>
            <li class="ui-state-default xsui-icon-only"><a href="{:U('UserType/type_edit')}"><i class="fa fa-plus"></i>新增类型</a></li>
            -->
            <li class="ui-state-default" style="padding:.3em 1.5em"><i class="fa fa-users"></i>用户类型</li>
            <foreach name="usertype_list" item="vo">
                <if condition="$search['type_name'] eq $key">
                    <li class="ui-state-active"><a href="{:U('User/user_list','type_name='.$key)}">{$vo}</a></li>
                    <else/>
                    <li class="ui-state-default"><a href="{:U('User/user_list','type_name='.$key)}">{$vo}</a></li>
                </if>
            </foreach>
        </ul>
    </div>
    <div id="grid-container">
        {$content}
    </div>
</block>
<block name="body_after">    
    <script type="text/javascript">
        
        $(function () {
            
            

            // 动态显示隐藏菜单 2015-10-24 SoChishun Added.
            $('td.status a').click(function () {
                var $a = $(this);
                $.get($a.attr('href'), function (data) {
                    if (data.status) {
                        var href = $a.attr('href');
                        if (href.indexOf('status/0') > -1) {
                            $a.attr('href', href.replace('status/0', 'status/1')).find('i').removeClass('fa-check').addClass('fa-times');
                        } else {
                            $a.attr('href', href.replace('status/1', 'status/0')).find('i').removeClass('fa-times').addClass('fa-check');
                        }
                    } else {
                        $('<div>' + data.info + '</div>').dialog();
                    }
                });
                return false;
            })
            // 动态更改排序 2015-10-24 SoChishun Added.
            $('td.sort input').blur(function () {
                var $input = $(this);
                var old_v = $input.data('value');
                if ($input.val() == old_v) {
                    return;
                }
                $.get($input.data('url').replace('varsort', $input.val()), function (data) {
                    if (data.status) {
                        location.reload();
                    } else {
                        $('<div>' + data.info + '</div>').dialog();
                    }
                })
            })
        })
    </script>
</block>